package com.vastcom.web.controller;

import com.vastcom.model.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/public")
public class PublicController {

    @GetMapping("getTestString")
    public String getTestString(){
        return "spring jwt is work";
    }
    @GetMapping("getObject")
    public User getAnTestObject(){
        User u=new User();
        u.setPassword("444");
        u.setUsername("666");
        return u;
    }

    @PostMapping("receiveAnObject")
public User receiveAnObject(@RequestBody User u){
        User t=new User();
                t.setPassword(u.getPassword());
        t.setUsername(u.getUsername());
        return t;
    }

    @PostMapping("receiveAnString")
    public String receiveAnString(@RequestBody String str){
    String rs="接收到的字符串是"+str;
    return rs;
    }

}
